<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>讲解员管理系统</title>
    <script>
        // 页面加载时设置默认用户信息
        (function() {
            // 设置默认的讲解员管理用户信息
            if (!localStorage.getItem('guideCurrentUser')) {
                localStorage.setItem('guideCurrentUser', JSON.stringify({
                    name: '讲解员管理员',
                    role: '讲解员管理员'
                }));
                localStorage.setItem('guideIsLoggedIn', 'true');
            }
        })();
    </script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #333;
            min-height: 100vh;
        }

        .container {
            display: flex;
            min-height: 100vh;
        }

        /* 左侧侧边栏 */
        .sidebar {
            width: 280px;
            background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 50%, #3b82f6 100%);
            color: white;
            padding: 0;
            box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
            position: fixed;
            height: 100vh;
            overflow-y: auto;
        }

        .sidebar-header {
            padding: 30px 20px;
            background: rgba(255, 255, 255, 0.1);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            margin-bottom: 20px;
            text-align: center;
        }

        .sidebar-title {
            font-size: 22px;
            font-weight: bold;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .nav-menu {
            list-style: none;
            padding: 0 15px;
        }

        .nav-item {
            margin-bottom: 8px;
        }

        .nav-link {
            display: flex;
            align-items: center;
            padding: 15px 20px;
            color: white;
            text-decoration: none;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            border-radius: 12px;
            border-left: 4px solid transparent;
        }

        .nav-link:hover, .nav-link.active {
            background: rgba(255, 255, 255, 0.1);
            border-left-color: #60a5fa;
            transform: translateX(5px);
        }

        .nav-icon {
            margin-right: 15px;
            font-size: 18px;
        }

        /* 右侧主内容区域 */
        .main-content {
            flex: 1;
            margin-left: 280px;
            padding: 30px;
            background: rgba(255, 255, 255, 0.95);
        }

        .content-header {
            background: white;
            padding: 25px 30px;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .header-left h1 {
            font-size: 28px;
            color: #1e3a8a;
            margin-bottom: 8px;
        }

        .breadcrumb {
            color: #6b7280;
            font-size: 14px;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-avatar {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            color: white;
        }

        .user-details {
            text-align: right;
        }

        .user-name {
            font-weight: bold;
            color: #1e3a8a;
            margin-bottom: 4px;
        }

        .user-role {
            color: #6b7280;
            font-size: 14px;
        }

        .btn-logout {
            background: #ef4444;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-logout:hover {
            background: #dc2626;
        }

        /* 功能模块样式 */
        .function-module {
            background: white;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
            overflow: hidden;
        }

        .module-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px 30px;
            font-size: 18px;
            font-weight: bold;
        }

        .module-content {
            padding: 30px;
        }

        /* 功能卡片网格 */
        .function-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 25px;
        }

        .function-card {
            background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            cursor: pointer;
            border: 2px solid transparent;
        }

        .function-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
            border-color: #3b82f6;
        }

        .function-icon {
            font-size: 48px;
            margin-bottom: 15px;
            text-align: center;
        }

        .function-title {
            font-size: 20px;
            font-weight: bold;
            color: #1e3a8a;
            margin-bottom: 10px;
            text-align: center;
        }

        .function-description {
            color: #6b7280;
            text-align: center;
            line-height: 1.6;
            margin-bottom: 20px;
        }

        .function-stats {
            display: flex;
            justify-content: space-around;
            text-align: center;
        }

        .stat-item {
            flex: 1;
        }

        .stat-number {
            font-size: 24px;
            font-weight: bold;
            color: #3b82f6;
            margin-bottom: 5px;
        }

        .stat-label {
            font-size: 12px;
            color: #6b7280;
        }

        /* 数据表格样式 */
        .data-table {
            width: 100%;
            border-collapse: collapse;
            background: white;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .data-table th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px;
            text-align: left;
            font-weight: 600;
        }

        .data-table td {
            padding: 15px;
            border-bottom: 1px solid #e5e7eb;
        }

        .data-table tr:hover {
            background: #f8fafc;
        }

        .status-badge {
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }

        .status-active {
            background: #dcfce7;
            color: #166534;
        }

        .status-inactive {
            background: #fef2f2;
            color: #dc2626;
        }

        .action-buttons {
            display: flex;
            gap: 8px;
        }

        .btn-action {
            padding: 6px 12px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.3s ease;
        }

        .btn-action-edit {
            background: #3b82f6;
            color: white;
        }

        .btn-action-edit:hover {
            background: #2563eb;
        }

        .btn-action-delete {
            background: #ef4444;
            color: white;
        }

        .btn-action-delete:hover {
            background: #dc2626;
        }

        .btn-action-view {
            background: #10b981;
            color: white;
        }

        .btn-action-view:hover {
            background: #059669;
        }

        /* 表单样式 */
        .form-container {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 25px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
        }

        .form-label {
            font-weight: 600;
            color: #374151;
            margin-bottom: 8px;
        }

        .form-input {
            padding: 12px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-actions {
            display: flex;
            gap: 15px;
            justify-content: flex-end;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-secondary {
            background: #6b7280;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-secondary:hover {
            background: #4b5563;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .sidebar {
                width: 100%;
                position: relative;
                height: auto;
            }
            
            .main-content {
                margin-left: 0;
            }
            
            .function-grid {
                grid-template-columns: 1fr;
            }
            
            .header-top {
                flex-direction: column;
                gap: 20px;
                text-align: center;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 左侧侧边栏 -->
        <nav class="sidebar">
            <div class="sidebar-header">
                <div class="sidebar-title">讲解员管理系统</div>
            </div>
            
            <ul class="nav-menu">
                <li class="nav-item">
                    <a href="#" class="nav-link active" onclick="switchFunction('add-guide')">
                        <span class="nav-icon">➕</span>
                        <span class="nav-text">新增讲解员信息</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" onclick="switchFunction('edit-guide')">
                        <span class="nav-icon">✏️</span>
                        <span class="nav-text">修改讲解员信息</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" onclick="switchFunction('delete-guide')">
                        <span class="nav-icon">🗑️</span>
                        <span class="nav-text">删除讲解员信息</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="life-science-management.html" class="nav-link">
                        <span class="nav-icon">🏠</span>
                        <span class="nav-text">返回主页</span>
                    </a>
                </li>
            </ul>
        </nav>

        <!-- 右侧主内容区域 -->
        <main class="main-content">
            <div class="content-header">
                <div class="header-top">
                    <div class="header-left">
                        <h1>讲解员管理</h1>
                        <div class="breadcrumb">生命科学馆管理 > 讲解员管理</div>
                    </div>
                    <div class="user-info">
                        <div class="user-avatar">👤</div>
                        <div class="user-details">
                            <div class="user-name" id="current-user-name">讲解员管理员</div>
                            <div class="user-role" id="current-user-role">讲解员管理员</div>
                        </div>
                        <button class="btn-logout" onclick="logout()">退出登录</button>
                    </div>
                </div>
            </div>

            <!-- 新增讲解员信息 -->
            <div id="add-guide-content" class="content-section">
                <div class="function-module">
                    <div class="module-header">新增讲解员信息</div>
                    <div class="module-content">
                        <div class="form-container">
                            <form id="add-guide-form">
                                <div class="form-grid">
                                    <div class="form-group">
                                        <label class="form-label">姓名 *</label>
                                        <input type="text" class="form-input" name="name" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">工号 *</label>
                                        <input type="text" class="form-input" name="employeeId" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">联系电话 *</label>
                                        <input type="tel" class="form-input" name="phone" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">邮箱</label>
                                        <input type="email" class="form-input" name="email">
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">专业领域 *</label>
                                        <select class="form-input" name="specialty" required>
                                            <option value="">请选择专业领域</option>
                                            <option value="生物学">生物学</option>
                                            <option value="化学">化学</option>
                                            <option value="物理学">物理学</option>
                                            <option value="医学">医学</option>
                                            <option value="环境科学">环境科学</option>
                                            <option value="其他">其他</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">工作经验(年) *</label>
                                        <input type="number" class="form-input" name="experience" min="0" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">入职日期 *</label>
                                        <input type="date" class="form-input" name="joinDate" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">状态</label>
                                        <select class="form-input" name="status">
                                            <option value="active">在职</option>
                                            <option value="inactive">离职</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <button type="button" class="btn-secondary" onclick="resetForm()">重置</button>
                                    <button type="submit" class="btn-primary">新增讲解员</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 修改讲解员信息 -->
            <div id="edit-guide-content" class="content-section" style="display: none;">
                <div class="function-module">
                    <div class="module-header">修改讲解员信息</div>
                    <div class="module-content">
                        <div class="form-container">
                            <div class="form-grid">
                                <div class="form-group">
                                    <label class="form-label">搜索讲解员</label>
                                    <input type="text" class="form-input" id="search-guide" placeholder="输入姓名或工号搜索">
                                </div>
                                <div class="form-group">
                                    <label class="form-label">&nbsp;</label>
                                    <button type="button" class="btn-primary" onclick="searchGuide()">搜索</button>
                                </div>
                            </div>
                        </div>

                        <div class="function-module">
                            <div class="module-header">讲解员列表</div>
                            <div class="module-content">
                                <table class="data-table">
                                    <thead>
                                        <tr>
                                            <th>工号</th>
                                            <th>姓名</th>
                                            <th>联系电话</th>
                                            <th>专业领域</th>
                                            <th>工作经验</th>
                                            <th>入职日期</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody id="guide-table-body">
                                        <tr>
                                            <td>G001</td>
                                            <td>张老师</td>
                                            <td>138****1234</td>
                                            <td>生物学</td>
                                            <td>5年</td>
                                            <td>2019-03-15</td>
                                            <td><span class="status-badge status-active">在职</span></td>
                                            <td class="action-buttons">
                                                <button class="btn-action btn-action-edit" onclick="editGuideInfo('G001')">编辑</button>
                                                <button class="btn-action btn-action-view" onclick="viewGuideInfo('G001')">查看</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>G002</td>
                                            <td>李老师</td>
                                            <td>139****5678</td>
                                            <td>化学</td>
                                            <td>3年</td>
                                            <td>2021-06-20</td>
                                            <td><span class="status-badge status-active">在职</span></td>
                                            <td class="action-buttons">
                                                <button class="btn-action btn-action-edit" onclick="editGuideInfo('G002')">编辑</button>
                                                <button class="btn-action btn-action-view" onclick="viewGuideInfo('G002')">查看</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>G003</td>
                                            <td>王老师</td>
                                            <td>137****9012</td>
                                            <td>物理学</td>
                                            <td>7年</td>
                                            <td>2017-09-10</td>
                                            <td><span class="status-badge status-active">在职</span></td>
                                            <td class="action-buttons">
                                                <button class="btn-action btn-action-edit" onclick="editGuideInfo('G003')">编辑</button>
                                                <button class="btn-action btn-action-view" onclick="viewGuideInfo('G003')">查看</button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 删除讲解员信息 -->
            <div id="delete-guide-content" class="content-section" style="display: none;">
                <div class="function-module">
                    <div class="module-header">删除讲解员信息</div>
                    <div class="module-content">
                        <div class="form-container">
                            <div class="form-grid">
                                <div class="form-group">
                                    <label class="form-label">搜索讲解员</label>
                                    <input type="text" class="form-input" id="delete-search-guide" placeholder="输入姓名或工号搜索">
                                </div>
                                <div class="form-group">
                                    <label class="form-label">&nbsp;</label>
                                    <button type="button" class="btn-primary" onclick="searchDeleteGuide()">搜索</button>
                                </div>
                            </div>
                        </div>

                        <div class="function-module">
                            <div class="module-header">讲解员列表</div>
                            <div class="module-content">
                                <table class="data-table">
                                    <thead>
                                        <tr>
                                            <th>工号</th>
                                            <th>姓名</th>
                                            <th>联系电话</th>
                                            <th>专业领域</th>
                                            <th>工作经验</th>
                                            <th>入职日期</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody id="delete-guide-table-body">
                                        <tr>
                                            <td>G001</td>
                                            <td>张老师</td>
                                            <td>138****1234</td>
                                            <td>生物学</td>
                                            <td>5年</td>
                                            <td>2019-03-15</td>
                                            <td><span class="status-badge status-active">在职</span></td>
                                            <td class="action-buttons">
                                                <button class="btn-action btn-action-delete" onclick="deleteGuideInfo('G001')">删除</button>
                                                <button class="btn-action btn-action-view" onclick="viewGuideInfo('G001')">查看</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>G002</td>
                                            <td>李老师</td>
                                            <td>139****5678</td>
                                            <td>化学</td>
                                            <td>3年</td>
                                            <td>2021-06-20</td>
                                            <td><span class="status-badge status-active">在职</span></td>
                                            <td class="action-buttons">
                                                <button class="btn-action btn-action-delete" onclick="deleteGuideInfo('G002')">删除</button>
                                                <button class="btn-action btn-action-view" onclick="viewGuideInfo('G002')">查看</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>G003</td>
                                            <td>王老师</td>
                                            <td>137****9012</td>
                                            <td>物理学</td>
                                            <td>7年</td>
                                            <td>2017-09-10</td>
                                            <td><span class="status-badge status-active">在职</span></td>
                                            <td class="action-buttons">
                                                <button class="btn-action btn-action-delete" onclick="deleteGuideInfo('G003')">删除</button>
                                                <button class="btn-action btn-action-view" onclick="viewGuideInfo('G003')">查看</button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        // 页面加载时设置用户信息
        document.addEventListener('DOMContentLoaded', function() {
            const currentUser = localStorage.getItem('guideCurrentUser');
            if (currentUser) {
                const user = JSON.parse(currentUser);
                document.getElementById('current-user-name').textContent = user.name || '讲解员管理员';
                document.getElementById('current-user-role').textContent = user.role || '讲解员管理员';
            }
        });

        // 功能切换
        function switchFunction(functionName) {
            // 移除所有活动状态
            document.querySelectorAll('.nav-link').forEach(link => {
                link.classList.remove('active');
            });
            
            // 添加活动状态到当前点击的链接
            event.target.closest('.nav-link').classList.add('active');
            
            // 隐藏所有内容
            const allContent = document.querySelectorAll('.content-section');
            allContent.forEach(content => {
                content.style.display = 'none';
            });

            // 显示对应内容
            const targetContent = document.getElementById(functionName + '-content');
            if (targetContent) {
                targetContent.style.display = 'block';
            }
        }

        // 新增讲解员表单提交
        document.getElementById('add-guide-form').addEventListener('submit', function(e) {
            e.preventDefault();
            const formData = new FormData(this);
            
            // 获取表单数据
            const guideData = {
                id: 'G' + Date.now(),
                name: formData.get('name'),
                employeeId: formData.get('employeeId'),
                phone: formData.get('phone'),
                email: formData.get('email'),
                specialty: formData.get('specialty'),
                experience: formData.get('experience'),
                joinDate: formData.get('joinDate'),
                status: formData.get('status')
            };

            // 这里可以添加数据验证和提交逻辑
            console.log('新增讲解员数据:', guideData);
            alert('讲解员信息添加成功！');
            
            // 重置表单
            this.reset();
        });

        // 重置表单
        function resetForm() {
            document.getElementById('add-guide-form').reset();
        }

        // 搜索讲解员
        function searchGuide() {
            const searchTerm = document.getElementById('search-guide').value;
            alert(`搜索讲解员: ${searchTerm}`);
        }

        // 搜索删除讲解员
        function searchDeleteGuide() {
            const searchTerm = document.getElementById('delete-search-guide').value;
            alert(`搜索删除讲解员: ${searchTerm}`);
        }

        // 编辑讲解员信息
        function editGuideInfo(id) {
            alert(`编辑讲解员信息 ID: ${id}`);
        }

        // 查看讲解员信息
        function viewGuideInfo(id) {
            alert(`查看讲解员信息 ID: ${id}`);
        }

        // 删除讲解员信息
        function deleteGuideInfo(id) {
            if (confirm('确定要删除这个讲解员吗？此操作不可恢复！')) {
                alert(`删除讲解员 ID: ${id}`);
            }
        }

        // 退出登录
        function logout() {
            localStorage.removeItem('guideIsLoggedIn');
            localStorage.removeItem('guideCurrentUser');
            window.location.href = 'life-science-management.html';
        }
    </script>
</body>
</html>
